# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from cifar10loader import Cifar10Preprocess
from mindspore_dataloader import create_dataset_cifar10
import bin_version as bv
import numpy as np
import pickle

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
    dataset = create_dataset_cifar10("./cifar-10-batches-bin/", batch_size=1)
    # dataset = create_dataset_cifar10("./dataset_demo", batch_size=1)
    for item in dataset.create_tuple_iterator(output_numpy=True):
        print(item[0])
        print(item[1])
        break
    print("aaaa")
    cifar_preprocess = Cifar10Preprocess("./dataset_demo/test_batch",
                                         dsize=224, rescale=1.0 / 255.0, shift=0.0,
                                         mean=(0.4914, 0.4822, 0.4465),
                                         std=(0.2023, 0.1994, 0.2010),
                                         batch_size=1)
    for image, label in cifar_preprocess:
        print(">>>", image)
        print(">>>", label)
        break
    print("*****")
    bin_ver = bv.Cifar10Preprocess("./cifar-10-batches-bin/test_batch.bin",
                                   dsize=224, rescale=1.0 / 255.0, shift=0.0,
                                   mean=(0.4914, 0.4822, 0.4465),
                                   std=(0.2023, 0.1994, 0.2010),
                                   batch_size=1)
    for image, label in bin_ver:
        print(">>>", image)
        print(">>>", label)
        break


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
